import os

import pyautogui

import config

class ScreenUtil:

    # 使用pyautogui进行截图操作
    @staticmethod
    def pc_screenshot():
        if os.name == 'nt':
            # return 'Windows'
            # 截取整个屏幕的截图
            screenshot = pyautogui.screenshot()
            # 保存截图
            screenshot.save(config.screenshot_save_path)
        elif os.name == 'posix':
            # return 'Linux/Unix/Mac OS X'
            os.system(f"screencapture {config.screenshot_save_path}")

    @staticmethod
    def mobile_screenshot():
        # 执行截屏并保存命令
        os.system("adb shell screencap -p /sdcard/screenshot.png")
        # 将保存的截图从手机复制到电脑中
        os.system("adb pull /sdcard/screenshot.png " + config.screenshot_save_path)
